****** First run "Clean Dataset and then "dofile2" 
// This file contains Table 1 and corresponding test of coefficients, and Table E1 

//create the chosen - dummy
gen chosenk1=1 
gen chosenk2=1
gen chosenk3=0
gen chosenk4=0

//Creating the new dataset
stack idk1 sex genk1 rankk1 treatment chosenk1 fempartsk1 totscorek1 totparscorek1 totfirstk1 id rankchos ///
idk2 sex genk2 rankk2 treatment chosenk2 fempartsk2 totscorek2 totparscorek2 totfirstk2 id rankchos ///
idk3 sex genk3 rankk3 treatment chosenk3 fempartsk3 totscorek3 totparscorek3 totfirstk3 id rankchos ///
idk4 sex genk4 rankk4 treatment chosenk4 fempartsk4 totscorek4 totparscorek4 totfirstk4 id rankchos, ///
into(idk sex gen rank treat chosen femparts totscore totparscore totfirst id rankchos) clear


//create the table 8
gen sexsc=gen*totscore
gen sexpsc=gen*totparscore
gen femxfemp=gen*femparts
gen centfemp=femparts-2.777027
gen genxcent=gen*centfemp
gen treattot=treat*totfirst
gen scorelist=totscore*totfirst
gen gentre=gen*treat

label variable gen "Female"
label variable chosen "Dep Var: Chosen"
label variable treat "First Author"
label variable totfirst "Listed First"
label variable totscore "Individual Score"
label variable sexsc "Female x Ind. Score"
label variable sexpsc "Female x Score"
label variable femxfemp "Fem. x Femparts"
label variable totparscore "Pair-Score"
label variable centfemp "Cent. Female Partners"
label variable genxcent "Female X Cent Fem Par" 
label variable treatto "Listed First x FA"
label var rank "Rank"
label var gentre "Female x First Author

//using rank

//checking correlation between relscore and relauth

 

//til deskriptiv tabell
mean gen if treat==0 & chosen==1
mean gen if treat==1 & chosen==1
mean gen if chosen==1
mean totparscore if gen==1 & treat==0
mean totparscore if gen==0 & treat==0
mean totparscore if gen==1 & treat==1
mean totparscore if gen==0 & treat==1

//difference from 50% probability benchmark
mean chosen if gen==1, cluster(id)
mean chosen if gen==1 & treat==1, cluster(id)
mean chosen if gen==1 & treat==0, cluster(id)




**********    Table E.1    **************

reg chosen gen totparscore totfirst centfemp genxcent if treat==1, cluster(idk) robust 
eststo l3

reg chosen gen centfemp genxcent totparscore totfirst if treat==0, cluster(idk)  robust
eststo l5

reg chosen gen gentre centfemp genxcent totparscore totfirst treat, cluster(idk)  robust  
eststo l6  

   
esttab  l3 l5 l6 using tablea_OLS.tex, noconstant ci star(* 0.10 ** 0.05 *** 0.01) label  ///
title("Probability of being chosen") ///
 nodepvars nomtitles mgroups("First-Author" "Alphabetical" "Overall", ///
pattern(1  1 1 )) nonotes order(gen  centfemp genxcent totparscore totfirst gentre treat) addnotes  ///
("Notes: OLS regressions with being chosen as the dependent" ///
"variable. Regressions in column 1 and 2 are run on observations" ///
"in the First-Author and Alphabetical treatment, respectively. Colomn 3 includes all observations" ///
"95\% confidence intervals in parenthesis. Standard errors are" /// 
"robust and clustered on candidate ID to control for the fact" /// 
" that subjects are presented as candidates multiple times. *,**," ///
"and *** denote significance at the 10\%, 5\% and 1\% level. The" ///
"lower panel indicates the number of observations.") ///
gap eqlabels(none) collabels(,lhs(Dep Var: Chosen)) replace




****** Table 2 ***********

 clogit chosen gen if treat==1, group(id) or robust 
eststo k2

 clogit chosen gen centfemp genxcent totscore  if treat==1, group(id) or robust 
eststo k1


 clogit chosen gen centfemp genxcent totparscore totfirst   if treat==1 , group(id)  robust or
 eststo k4
 
 clogit chosen gen if treat==0, group(id) or robust 
eststo k5

 clogit chosen gen centfemp genxcent totscore  if treat==0, group(id) or robust 
eststo k6 


clogit chosen gen centfemp genxcent totparscore totfirst   if treat==0, group(id)  robust or
 eststo k8
 
  clogit chosen gen centfemp genxcent totparscore totfirst treattot, group(id) or robust
 eststo k9
   
esttab  k2 k1  k4 k5 k6  k8 k9 using table3.tex,eform se star(* 0.10 ** 0.05 *** 0.01) label  ///
title("Probability of being chosen") ///
 nodepvars nomtitles mgroups("First-Author" "Alphabetical" "Overall", ///
pattern(1 0 0 1 0 0 1 )) nonotes order(gen centfemp genxcent totparscore totfirst treattot) addnotes  ///
("Notes: Clogit regressions with being chosen as the dependent" ///
"variable. Regressions in column 1-3 and 4-7 are run on observations" ///
"in the First-Author and alphabetical treatment, respectively." ///
"Robust standard errors in parenthesis. *,**, and *** denote" /// 
"significance at the 10%, 5% and 1% level. The lower panel indicates" ///
"the number of observations.") ///
gap eqlabels(none) collabels(,lhs(Dep Var: Chosen)) replace 


****** Testing difference between the coefficicnet in different models *******

qui clogit chosen gen if treat==1, group(id) 
 eststo k2
 
 qui clogit chosen gen centfemp genxcent totscore if treat==1, group(id) 
 eststo s2
 
qui clogit chosen gen centfemp genxcent totparscore totfirst  if treat==1 , group(id)  
 eststo k3
 
 
 
 
qui clogit chosen gen if treat==0, group(id) 
 eststo k5
 
 qui clogit chosen gen centfemp genxcent totscore if treat==0, group(id) 
 eststo s5
 
 
 clogit chosen gen totparscore totfirst centfemp genxcent  if treat==0, group(id) 
 eststo k8
 
 
   
suest k2 k5, 
test [k2_chosen]gen=[k5_chosen]gen

suest s2 s5
test [s2_chosen]totscore=[s5_chosen]totscore

suest s2 s5
test [s2_chosen]gen=[s5_chosen]gen


suest k3 k8
test [k3_chosen]gen=[k8_chosen]gen



